﻿using System.ComponentModel;
using System.Drawing.Design;

namespace Marmat.Forms
{
    [ToolboxItem(true)]
    public partial class PropertyGrid
    {
        public PropertyGrid()
        {
            InitializeComponent();
            PropertyGridControl1.Name = "PropertyGridControl1";
        }

        [DefaultValue(null)]
        [TypeConverter(typeof(SelectedObjectConverter))]
        [Category("CatBehavior")]
        [Description("PropertyGridSelectedObjectDesc")]
        public object SelectedObject
        {
            get
            {
                return this.PropertyGridControl1.SelectedObject;
            }

            set
            {
                this.PropertyGridControl1.SelectedObject = value;
            }
        }

        public event PropertyValueChangedEventHandler PropertyValueChanged;

        public delegate void PropertyValueChangedEventHandler(object s, DevExpress.XtraVerticalGrid.Events.CellValueChangedEventArgs e);

        private void PropertyGridControl1_CellValueChanged(object sender, DevExpress.XtraVerticalGrid.Events.CellValueChangedEventArgs e)
        {
            PropertyValueChanged?.Invoke(this, e);
        }
    }
}